package org.activequant.util.charting;

/**
 * Plot service consists of a single plot, that is shared
 * by data series. All series are drawn in the same scale (x and y).
 * This service is geared toward incremental data update and is suitable for drawing
 * most time series.
 * <p>
 * Template parameter determines the type of the X-axis. 
 * Typical values are TimeStamp (for time-based axis), and Double (for numeric-based axis).
 * <p>
 * IPlotService&lt;T&gt; is an interface. Defines the nested ISeriesService&lt;X&gt; interface.<br/>
 * Defines the following method:
 * <ul>
 * <li>ISeriesService&lt;T&gt; newSeries(String label)</li>
 * </ul>
 * <b>History:</b><br>
 *  - [17.12.2007] Created (Mike Kroutikov)<br>
 *
 *  @author Mike Kroutikov
 */
public interface IPlotService<T> {

	/**
	 * Interface that provides access to a single series on the plot.<br/>
	 * ISeriesService&lt;X&gt; is a nested interface. Defines the following method:
	 * <ul>
	 * <li>void addDataPoint(X x, double y)</li>
	 * </ul>
	 */
	public interface ISeriesService<X> {
		
		/**
		 * Adds another data point to the series.<br/>
		 * <code>void addDataPoint(X x, double y)</code>
		 * @param x x-value.
		 * @param y y-value.
		 */
		void addDataPoint(X x, double y);
	}
	
	/**
	 * Creates another series to be drawn on the same plot. All series share the same scale of X and Y axis (usually, automatic).<br/>
	 * Should create and return a new ISeriesService&lt;T&gt; with the given label(String)
	 * @param label label that describes this series on the plot legend.
	 * @return service interface (data sink).
	 */
	ISeriesService<T> newSeries(String label);
}
